-
Notifications
You must be signed in to change notification settings - Fork 392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CB-5197 create main connection fields dynamically #2693
CB-5197 create main connection fields dynamically #2693
Conversation
server/bundles/io.cloudbeaver.server/schema/service.core.graphqls
Outdated
Show resolved
Hide resolved
webapp/packages/core-blocks/src/ObjectPropertyInfo/ObjectPropertyInfoForm/RenderField.tsx
Outdated
Show resolved
Hide resolved
webapp/packages/core-sdk/src/queries/fragments/DatabaseDriver.gql
Outdated
Show resolved
Hide resolved
webapp/packages/core-sdk/src/queries/fragments/DriverMainPropertyInfo.gql
Outdated
Show resolved
Hide resolved
webapp/packages/plugin-connections/src/ConnectionForm/Options/ConnectionOptionsTabService.ts
Outdated
Show resolved
Hide resolved
webapp/packages/plugin-connections/src/ConnectionForm/Options/getDefaultConfigurationType.ts
Outdated
Show resolved
Hide resolved
webapp/packages/plugin-connections/src/ConnectionForm/Options/getDefaultConfigurationType.ts
Outdated
Show resolved
Hide resolved
server/bundles/io.cloudbeaver.server/schema/service.core.graphqls
Outdated
Show resolved
Hide resolved
webapp/packages/plugin-connections/src/ConnectionForm/Options/ConnectionOptionsTabService.ts
Show resolved
Hide resolved
webapp/packages/plugin-connections/src/ConnectionForm/Options/ConnectionOptionsTabService.ts
Show resolved
Hide resolved
@Property | ||
public Map<String, String> getMainProperties() { | ||
Map<String, String> mainProperties = new LinkedHashMap<>(); | ||
mainProperties.put(DBConstants.PROP_HOST, dataSourceContainer.getConnectionConfiguration().getHostName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may be move dataSourceContainer.getConnectionConfiguration() to parameter
server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/WebServiceUtils.java
Outdated
Show resolved
Hide resolved
server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/WebServiceUtils.java
Show resolved
Hide resolved
@@ -248,6 +248,10 @@ type DriverInfo { | |||
# Driver parameters (map name->value) | |||
driverParameters: Object! | |||
|
|||
# Main driver properties | |||
# Contains info about main fields (host, port, database, server name) | |||
mainProperties: [ObjectPropertyInfo!]! @since(version: "24.1.1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mainProperties
sounds strange 🤔
server/bundles/io.cloudbeaver.server/schema/service.core.graphqls
Outdated
Show resolved
Hide resolved
databaseName: String @deprecated(reason: "24.1.1, use mainProperties") | ||
|
||
# Host, port, serverName, databaseName are stored and mainProperties | ||
mainProperties: Object @since(version: "24.1.1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
…//github.com/dbeaver/cloudbeaver into CB-5197-create-connection-fields-dynamically
|
||
const config = contexts.getContext(connectionConfigContext); | ||
const stateContext = contexts.getContext(formStateContext); | ||
const driver = await this.dbDriverResource.load(data.config.driverId!, ['includeProviderProperties']); | ||
const driver = await this.dbDriverResource.load(data.config.driverId!, ['includeProviderProperties', 'includeMainProperties']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may be like this? i dont like when we trick TS like this with "!"
const config = contexts.getContext(connectionConfigContext); | |
const stateContext = contexts.getContext(formStateContext); | |
const driver = await this.dbDriverResource.load(data.config.driverId!, ['includeProviderProperties']); | |
const driver = await this.dbDriverResource.load(data.config.driverId!, ['includeProviderProperties', 'includeMainProperties']); | |
if (!data.info || !data.config.driverId) { | |
return; | |
} | |
const config = contexts.getContext(connectionConfigContext); | |
const stateContext = contexts.getContext(formStateContext); | |
const driver = await this.dbDriverResource.load(data.config.driverId, ['includeProviderProperties', 'includeMainProperties']); |
} | ||
|
||
const driverConfiguration: IDriverConfiguration[] = [ | ||
{ | ||
name: 'Manual', | ||
value: DriverConfigurationType.Manual, | ||
isVisible: driver => driver.configurationTypes.includes(DriverConfigurationType.Manual), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we add here also extra check that some properties are exists like you did in DriverConfigurationType.Custom
a little bit below?
}, | ||
{ | ||
name: 'URL', | ||
value: DriverConfigurationType.Url, | ||
isVisible: driver => driver.configurationTypes.includes(DriverConfigurationType.Url), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
if (tempConfig.configurationType === DriverConfigurationType.Custom && !!driver.mainProperties?.length) { | ||
tempConfig.mainProperties = this.prepareDynamicProperties(driver.mainProperties, tempConfig.mainProperties, tempConfig.configurationType); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i will suggest to use switch(tempConfig.configurationType)
to exclude unwanted effects from different types of configuration so you can be sure that you'll sent only state related to selected configuration
for example:
tempConfig.mainProperties = toJS(state.config.mainProperties);
always set
it can reflect on:
if (tempConfig.configurationType === DriverConfigurationType.Custom && !!driver.mainProperties?.length) {
tempConfig.mainProperties = this.prepareDynamicProperties(driver.mainProperties, tempConfig.mainProperties, tempConfig.configurationType);
}
…ction-fields-dynamically
b8a74ac
to
e7b0225
Compare
No description provided.